#ifndef COMMONPAGE_H
#define COMMONPAGE_H

#include <QWidget>
#include<QVector>
#include<musiclist.h>
namespace Ui {
class CommonPage;
}
enum PageType
{
  LIKE_PAGE,
  LOCK_PAGE,
  HISTORY_PAGE

};
class CommonPage : public QWidget
{
    Q_OBJECT

public:
    explicit CommonPage(QWidget *parent = nullptr);
    ~CommonPage();
    void setCommonUI(const QString&text,const QString&imagePath);
    void addListItem(const QString&name,const QString&singer,const QString&altum);//对UI下面的QList中添加元素
    void setPageType(PageType pageType);
    void addMusicToMusicPage(MusicList&musicList);
    void reFresh(MusicList&musicList);
    void addMusicToPlaylist(MusicList&musicList,QMediaPlaylist*playList);//将每一个页面的音乐添加到播放列表中；
    QString getMusicId(int index);
    void setCurrentImage(QPixmap pixmap);
signals:
    void updateLikePage(const QString&musicId);
    void playAll(PageType pageType);
    void playMusicIndex(CommonPage*,int);
private slots:
    void on_playAllBt_clicked();

private:
    Ui::CommonPage *ui;
    PageType _pageType;
    QVector<QString>_listId;
};
#endif // COMMONPAGE_H
